package com.example.streamproducer.highlevel;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.stereotype.Component;

/**
 * @Author: lihui
 * @Date: 2022-03-23 10:32
 * @Description:
 */
@Component
@EnableBinding(MyProcessor.class)
public class SmsAndEmailMessageConsumer {

    @StreamListener(MyProcessor.SMS_MESSAGE)
    public void receiveSms(String smsMessage){
        System.out.println("短信消息接收成功，sms message = " + smsMessage);
    }

    @StreamListener(MyProcessor.EMAIL_MESSAGE)
    public void receiveEmail(String emailMessage){
        System.out.println("邮件消息接收成功，email message = " + emailMessage);
    }

}
